package com.system.service.task;//package com.system.service.task;

import com.system.common.MD5;
import com.system.common.Mail;
import com.system.common.emailUtil;
import com.system.service.FileService;
import com.system.service.dao.model.Filedata;
import com.system.service.impl.FileServiceImpl;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.File;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by lenovo on 2016/3/22.
 */
@Service
public class TimeTask {

    @Resource
    FileService fileService;



    @Scheduled(cron = "0/10 * * * * ?")   //每10秒扫描一次
    public void test()  {
            File file=new File(Filedata.filePath);
         if(Filedata.status==0){  //执行初始化操作
             try {
                 fileService.initAllFiles(file);
             } catch (Exception e) {
                 e.printStackTrace();
             }
         }else{
             try {
                 fileService.show(file);
             } catch (Exception e) {
                 e.printStackTrace();
             }
         }



      System.out.print("aaaa");

    }

}
